import java.util.Scanner;

public class find1 //二分查找
{
    public static int search(int n,int[] a){
        int low=0;
        int high=a.length-1;

        while(low<=high){
            int mid=(low+(high-low)/2);
            if(a[mid]==n){
                return mid;
            }
            else if(n<a[mid]){
                high=mid-1;

            }
            else{
                low=mid+1;
            }
        }
        return -1;
    }
    public static int search1(int n,int[] a,int high,int low){
        if(low<=high){
            int mid=(low+high)/2;
            if(n<a[mid]){
                return mid;
            }
            else if(n<low){
            return search1(n,a,mid-1,low);
            }
            else{
                return search1(n,a,high,mid+1);
            }

        }else
            return -1;
    }

    public static void main(String[] args) {
        int[] a=new int[10];
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<10;i++){
            a[i]=sc.nextInt();
        }
        int p=search(8,a);
        System.out.println(p);
    }
}
